package cn.openbiotoken;

public interface Biometrics {

    byte MIN_CONFIDENCE_PERCENTAGE = 0;

    byte MAX_CONFIDENCE_PERCENTAGE = 100;

    byte DEFAULT_CONFIDENCE_PERCENTAGE = MAX_CONFIDENCE_PERCENTAGE;

    static byte legalizeConfidencePercentage(final int confidencePercentage) {
        if (confidencePercentage>MAX_CONFIDENCE_PERCENTAGE) {
            return MAX_CONFIDENCE_PERCENTAGE;
        }

        if (confidencePercentage<MIN_CONFIDENCE_PERCENTAGE) {
            return MIN_CONFIDENCE_PERCENTAGE;
        }

        return (byte)confidencePercentage;
    }
}
